import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';

export default async function a024(fd: IFeidaoAiBrowserComponent, args: Event) {
	// 选择列表复选框
	// 阻止把事件分派到其他节点。
	window.event ? window.event.cancelBubble = true : args.stopPropagation();
	const all_boxs = fd.data.node.querySelectorAll('[data-feidao-name="list_checkbox"]');
	const c_boxs = fd.data.node.querySelectorAll('[data-feidao-name="list_checkbox"]:checked');
	const n = fd.data.node.querySelector<HTMLInputElement>('[data-feidao-id="checkall"]');
	if (all_boxs.length === c_boxs.length) {
		n.checked = true;
	} else {
		n.checked = false;
	}
}
